﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Apollo;

namespace Apollo.Website
{
    public partial class GenFormString : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Redirect("/EditFormEditor.aspx?EntityId=" + this.Request["EntityId"]);
            return;

            string entityId = this.Request["EntityId"];
            Entity entity = Apollo.Application.Meta<Entity>()
                .SingleOrDefault<Entity>(en => en.Id.ToString() == entityId);

            if (entity == null)
                return;

            ImageEntityIcon.ImageUrl = string.IsNullOrEmpty(entity.IconPath) ? "/css/icons/icon_01.png" : entity.IconPath;
            LabelEntityName.Text = entity.Name;

            TextBoxFormString.Text = Apollo.Core.Form.GenerateDefault(entity).ToXml().ToString();
        }
    }
}